<template>
<div>
  <p>未绑定的学生</p>
    <ul>
      <li v-for="i in student">{{i.name}}<button @click="bind(i.id)">绑定</button></li>
    </ul>
</div>
</template>

<script>
export default {
  name: "bind",
  data(){
    return{
      student:[]
    }
  },
  methods:{
    get_student(){
      this.$axios.get('users/student/')
      .then(res=>{
        if(res.data.code==200){
          this.student = res.data.list
        }
      })
    },
    bind(id){
      let userid =localStorage.getItem('userid')
      this.$axios.put('users/student/?userid='+userid+'&id='+id)
      .then(res=>{

      })
    }
  },
  mounted() {
    this.get_student()
  }
}
</script>

<style scoped>

</style>